<!-- 详情 -->
<template>
  <div class="vue-box submit-box--dialog" style="width: 1000px">
    <!-- ------- 内容部分 ------- -->
    <div class="c-card">
      <el-form class="form-box" label-width="12em" label-position="top">
        <show-info :name="item.name" v-for="(item,index) in formCfg">{{ state.model[item.prop] }}</show-info>
      </el-form>
    </div>
  </div>
</template>

<script setup name="sys-user-info">
import { onMounted, reactive, ref } from 'vue'
import comTable from '@/sa-frame/com/table/table.vue'

// 获取插值
const prop = defineProps({
  param: { type: Object },
})

// ------------------ 数据 ------------------
const state = reactive({
  id: prop.param.id || 0, // 获取传值id （0=添加，非0=修改）
  model: {}, // 数据 Model
})
const formCfg = ref([{
    name: '所属医疗机构',
    prop: 'fixmedins_code'
},{
    name: '医院科室名称',
    prop: 'hosp_dept_name'
},{
    name: '医院科室编码',
    prop: 'hosp_dept_codg'
},{
    name: '科别',
    prop: 'caty'
},{
    name: '成立时间',
    prop: 'dept_estbdat'
},{
    name: '开始时间',
    prop: 'begntime'
},{
    name: '结束时间',
    prop: 'endtime'
},{
    name: '科室负责人姓名',
    prop: 'dept_resper_name'
},{
    name: '科室负责人电话',
    prop: 'dept_resper_tel'
},{
    name: '医师人数',
    prop: 'dr_psncnt'
},{
    name: '药师人数',
    prop: 'phar_psncnt'
},{
    name: '护士人数',
    prop: 'nurs_psncnt'
},{
    name: '技师人数',
    prop: 'tecn_psncnt'
},{
    name: '批准床位数量',
    prop: 'aprv_bed_cnt'
},{
    name: '医保认可床位数',
    prop: 'hi_crtf_bed_cnt'
},{
    name: '科室医疗服务范围',
    prop: 'dept_med_serv_scp'
},{
    name: '统筹区编号',
    prop: 'poolarea_no'
},{
    name: '简介',
    prop: 'itro'
},{
    name: '备注',
    prop: 'memo'
}])

// 组件加载时触发
onMounted(() => {
  f5()
})

// ------------------ 函数 ------------------
// 查询
const f5 = function () {
    const params = {
      deptId: state.id
    }
    sa.ajax('/api/webPresAdmin/deptDetail', params,function (res) {
      if (!res.data) {
        return sa.alert('数据不存在')
      }
      state.model = res.data
      getOrgList(res.data.fixmedins_code)
    })
}

// 获取机构下拉框
function getOrgList(fixmedins_code = '') {
  const params = {
    pageindex: 0,
    pagesize: 300,
    fixmedins_code,
  }
  sa.ajax('/api/webPresAdmin/medinsinfoList', params,function (res) {
    // orgList.value = res.data.map(item => {
    //     return {
    //         value: item.fixmedins_code,
    //         label: item.fixmedins_name
    //     }
    // })
  })
}
</script>

<style scoped lang="scss">
@use '@/sa-frame/sa.scss' as *;
.form-box {
  display: flex;
  flex-wrap: wrap;
  .c-item {
    flex: 0 0 33.3%;
    margin-bottom: 20px;
  }
}
.c-item {
  margin-bottom: 15px;
}
.pic-tab {
  .item {
    background: #f2f3f5;
    padding: 5px 20px;
    border-radius: 5px;
    margin-right: 10px;
    cursor: pointer;
    &:hover {
      color: $primary;
    }
  }
}
.pic-box {
  min-height: 280px;
}
</style>
